package remote.controls
{
	import remote.containers.HGroup;
	import remote.enums.HAlgin;
	import remote.skins.DefaultListItemSkin;
	import remote.skins.SolidRectangleSkin;
	
	/**
	 *
	 * @author 银魂飞雪
	 * @createDate 2011-4-24
	 */
	public class DefaultListItemRender extends HGroup implements IListItemRender
	{
		private var _txt:Label;
		
		protected var _selected:Boolean = false;
		protected var _data:Object;
		public function DefaultListItemRender()
		{
			super();
		}
		
		override protected function initProperty():void
		{
			super.initProperty();
			halgin = HAlgin.CENTER;
			this.mouseChildren = false;
		}
		
		override protected function createChildren():void
		{
			super.createChildren();
			_txt = new Label();
			addChild(_txt);
		}
		
		override protected function createSkin():void
		{
			_skin = new DefaultListItemSkin();
		}
		
		override public function setMouseStatus(value:String):void
		{
			super.setMouseStatus(value);
			updateSkin();
		}
		
		public function update():void
		{
			if(data != null)
				_txt.text = _data.toString();
			else
				_txt.text = "";
		}
		
		public function set data(value:Object):void
		{
			_data = value;
			update();
		}
		
		public function get data():Object
		{
			return _data;
		}
		
		public function set selected(value:Boolean):void
		{
			if(_selected != value)
			{
				_selected = value;
				updateSkin();
				
			}
		}
		
		public function get selected():Boolean
		{
			return _selected;
		}
		
		public function get index():int
		{
			// TODO Auto Generated method stub
			return 0;
		}
		
		public function set index(value:int):void
		{
			// TODO Auto Generated method stub
			
		}
		
	}
}